package decorator;

/**
 * 客户端
 * @author DFD
 * @date 2023年11月17日
 */
public class CoffeeBar {

	public static void main(String[] args) {
		System.out.println("=========================写法一=============================");
		// 1. 点一份 LongBlack
		Drink drink1 = new LongBlack();
		System.out.println(drink1.getDes() + ":费用=" + drink1.cost());

		// 用装饰者类装饰一下 Drink
		Decorator decorator = new Decorator(drink1);

		// 2. 加入一份牛奶
		decorator = new Milk(drink1);
		System.out.println(
				"加入一份" + decorator.decoratorDesc() + ",费用=" + decorator.getPrice() + ",总费用 = " + decorator.cost());

		// 3. 加入一份豆浆
		decorator = new Soy(decorator);
		System.out.println(
				"加入一份" + decorator.decoratorDesc() + ",费用=" + decorator.getPrice() + ",总费用 = " + decorator.cost());

		// 4. 加一份巧克力
		decorator = new Chocolate(decorator);
		System.out.println(
				"加入一份" + decorator.decoratorDesc() + ",费用=" + decorator.getPrice() + ",总费用 = " + decorator.cost());

		System.out.println("小票 = " + decorator.getDes());
		System.out.println("=========================写法二=============================");
		
		// 1. 点一份 DeCafe
		Drink drink2 = new DeCaf();
		System.out.println("费用1=" + drink2.cost());
		System.out.println("描述=" + drink2.getDes());

		// 2. order 加入一份牛奶
		drink2 = new Milk(drink2);

		System.out.println("order 加入一份牛奶 费用 =" + drink2.cost());
		System.out.println("order 加入一份牛奶 描述 = " + drink2.getDes());

		// 3. order 加入一份巧克力

		drink2 = new Chocolate(drink2);

		System.out.println("order 加入一份牛奶 加入一份巧克力  费用 =" + drink2.cost());
		System.out.println("order 加入一份牛奶 加入一份巧克力 描述 = " + drink2.getDes());
	}

}
